package own.stu.jobgib.playown.juc.threadLocal;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class InheritableThreadLocalTest {

    public static void main(String[] args) {
        InheritableThreadLocal<String> t1 = new InheritableThreadLocal<>();
        t1.set("1");
        /*new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("我是子线程,t1:" + t1.get());
            }
        }).start();
        System.out.println("我是主线程,t1:" + t1.get());*/
        ExecutorService executorService = Executors.newFixedThreadPool(2);
        executorService.submit(() -> {
            System.out.println(Thread.currentThread().getName() + "  === : " + t1.get());
        });

        executorService.shutdown();
    }
}
//我是主线程,t1:1
//我是子线程,t1:1
